﻿using dz.u9.jky.schema.Attrib;
using dz.u9.jky.schema.Common;
using System;
using System.Collections.Generic;

namespace dz.u9.jky.schema.GL
{
    /// <summary>
    /// 凭证
    /// </summary>
    public class DzISVImportVoucherDTO
    {
        /// <summary>
        /// 附单据数
        /// </summary>
        public int AttachmentCount { get; set; } = 0;

        /// <summary>
        /// 现金流量
        /// </summary>        
        [DzList("UFIDA.U9.ISV.GL.ISVGLImportSV.ISVImportCFVoucherItemDTO,UFIDA.U9.ISV.GL.ISVGLImportSV")]
        public List<DzISVImportCFVoucherItemDTO> CFVoucherItems { get; set; }

        /// <summary>
        /// 分录
        /// </summary>        
        [DzList("UFIDA.U9.ISV.GL.ISVGLImportSV.ISVImportEntryDTO,UFIDA.U9.ISV.GL.ISVGLImportSV")]
        public List<DzISVImportEntryDTO> Entries { get; set; }

        /// <summary>
        /// 是否使用调用方传入的凭证号替代系统生成的
        /// </summary>
        public bool IsImportVoucherDisplayCode { get; set; } = false;

        /// <summary>
        /// 制单日期 该属性不可为空
        /// </summary>
        public DateTime CreateDate { get; set; }

        /// <summary>
        /// 弹性域
        /// </summary>
        [DzComplexObject("UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments,UFIDA.U9.Base.BaseBE")]
        public DescFlexField DescFlexField { get; set; }

        /// <summary>
        /// 导入方式 (该属性可为空,但有默认值),0:导入凭证 1：导入凭证和现金流量项目
        /// </summary>        
        [DzEnum("UFIDA.U9.CBO.FI.Enums.VoucherImportTypeEnum,UFIDA.U9.CBO.FIBE")]
        public int ImportType { get; set; } = 0;

        /// <summary>
        /// 是否使用调用方传入的行序号替代系统生成的
        /// </summary>
        public bool IsImportSerialNo { get; set; } = false;

        /// <summary>
        /// 记账会计期间 (如“2012-05",该属性不可为空,且无默认值)
        /// </summary>
        public string PostedPeriod { get; set; }

        /// <summary>
        /// 账簿编码 不可为空,且无默认值
        /// </summary>
        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string SOB { get; set; }

        /// <summary>
        /// 账簿版本
        /// </summary>        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string SOBVersion { get; set; }

        /// <summary>
        /// 凭证类型编码 不可为空,且无默认值
        /// </summary>
        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string VoucherCategory { get; set; }

        /// <summary>
        /// 凭证号 
        /// </summary>
        public string VoucherDisplayCode { get; set; }

        /// <summary>
        /// 凭证类别
        /// </summary>
        
        [DzEnum("UFIDA.U9.GL.GLCBO.VoucherKindEnum,UFIDA.U9.GL.GLBE")]
        public int VoucherKind { get; set; } = 3;

    }

    /// <summary>
    /// 现金流量
    /// </summary>
    public class DzISVImportCFVoucherItemDTO
    {
        /// <summary>
        /// 现金流量项目
        /// </summary>
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string CashFlowItem { get; set; }

        /// <summary>
        /// 现金流量项目流向 0 增 1 减
        /// </summary>
        [DzEnum("UFIDA.U9.CBO.FI.CashFlow.CashFlowItemPropertyEnum,UFIDA.U9.CBO.FIBE")]
        public int CashFlowItemAttr { get; set; }

        /// <summary>
        /// 币种
        /// </summary>

        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string Currency { get; set; }

        /// <summary>
        /// 本币金额
        /// </summary>
        public decimal LCMoney { get; set; } = 0;

        /// <summary>
        /// 原币金额
        /// </summary>
        public decimal OCMoney { get; set; } = 0;

        /// <summary>
        /// 关系企业
        /// </summary>
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string RelOrg { get; set; }

        /// <summary>
        /// 现金流量行号
        /// </summary>
        public int SerialNumber { get; set; }

    }

    /// <summary>
    /// 分录
    /// </summary>
    public class DzISVImportEntryDTO
    {
        /// <summary>
        /// 摘要 必输
        /// </summary>
        public string Abstracts { get; set; }


        /// <summary>
        /// 会计科目编码 必输
        /// </summary>
        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string Account { get; set; }

        /// <summary>
        /// 本币贷方金额
        /// </summary>

        public decimal AccountedCr { get; set; } = 0;

        /// <summary>
        /// 本币借方金额
        /// </summary>
        public decimal AccountedDr { get; set; } = 0;

        /// <summary>
        /// 贷方数量
        /// </summary>
        public decimal AmountCr { get; set; } = 0;

        /// <summary>
        /// 借方数量
        /// </summary>
        public decimal AmountDr { get; set; } = 0;

        /// <summary>
        /// 银行账号
        /// </summary>        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string BankAccount { get; set; }

        /// <summary>
        /// 银行回单日期
        /// </summary>
        public DateTime BankReturnDate { get; set; }

        /// <summary>
        /// 现金账号
        /// </summary>        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string CashAccount { get; set; }

        /// <summary>
        /// 币种
        /// </summary>

        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string Currency { get; set; }

        /// <summary>
        /// 弹性域
        /// </summary>
        [DzComplexObject("UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments,UFIDA.U9.Base.BaseBE")]
        public DescFlexField Description { get; set; }

        /// <summary>
        /// 原币贷方金额
        /// </summary>
        public decimal EnteredCr { get; set; }

        /// <summary>
        /// 原币借方金额
        /// </summary>
        public decimal EnteredDr { get; set; } = 0;

        /// <summary>
        /// 汇率类型
        /// </summary>        
        [DzEnum("UFIDA.U9.Base.Currency.ExchangeRateTypesEnum,UFIDA.U9.Base.BaseBE")]
        public int ExchangeRateTypes { get; set; } = 0;

        /// <summary>
        /// 超预算执行金额
        /// </summary>
        public decimal ExtraExecutedMoney { get; set; } = 0;

        /// <summary>
        /// 收支项目
        /// </summary>        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string IncomeExpendItem { get; set; }

        /// <summary>
        /// 票据号
        /// </summary>
        public string NMDocNo { get; set; }

        /// <summary>
        /// 对本币汇率 
        /// </summary>
        public decimal OCToFCExchangeRate { get; set; } = 1;

        /// <summary>
        /// 项目编号
        /// </summary>
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string ProjectCode { get; set; }

        /// <summary>
        /// 行号
        /// </summary>
        public int SerialNo { get; set; }

        /// <summary>
        /// 结算方式
        /// </summary>
        public string SettlementMethod { get; set; }

        /// <summary>
        /// 任务编号
        /// </summary>
        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string TaskCode { get; set; }

    }
}
